
%{

#include "attributs.h"

#include "parser.h"

int ligne = 1, colonne = 1;

extern int yyerror ( char* message );

%}

%%

[a-zA-Z]+		colonne+=yyleng; return IDENT;
[0-9]+			colonne+=yyleng; return ENTIER;
[0-9]+"."[0-9]*	colonne+=yyleng; return REEL;
"+"				colonne+=yyleng; return OP_ADD;
"-"				colonne+=yyleng; return OP_SUB;
"*"				colonne+=yyleng; return OP_MUL;
"/"				colonne+=yyleng; return OP_DIV;
"="				colonne+=yyleng; return OP_AFFECT;
[ \t]+			colonne+=yyleng;
.				yyerror ( "unknown item in input" ); colonne++;
\n				colonne = 1; ligne+=1;

%%

int yyerror ( char* message )
{
	printf ("Error [%d,%d]: %s\n", ligne, colonne, message );
	return 0;
}
